//////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // ------------------------ Ebrahim Foulaadvand & somayyeh Belbaasi, 22 Oct. 2008 ----------------------- // // // // --- The programme "CoffeeCool" evaluates the temporal evolution of the temperature of a coffee cup // // by the Euler algorithm. // // // // // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////// #include #include #include #include #include #include #include #include #include #include #include using namespace std; double tau=0.01, Ts=0., T0=100., r=1; //tau=time step, Ts=surrounding temperature, T0=initial temperature of coffee cup, r=cooling rate // int N=2000,t; // N=number of time steps main() { ofstream fileT ("T-t.plt"); // output file for the time dpendence of temperature. vector T(N+1,0); // Array T stores the coffee temperature at time step t. T[0]=T0; // -------- initial condition ------------- //---------------------- Euler-Cromer Method--------------------- for(int t=0;t